<!--
 * @Author: 朱自强
 * @Date: 2023-11-09 11:15:37
 * @LastEditors: 朱自强
 * @LastEditTime: 2023-11-09 15:42:28
 * @FilePath: \vite-project\src\App.vue
 * @Description: 
 * 
 * Copyright (c) 2023 by 朱自强, All Rights Reserved. 
-->

<template>
  <n-config-provider :locale="zhCN" :date-locale="dateZhCN" :theme-overrides="themeOverrides">
    <RouterView></RouterView>
  </n-config-provider>
</template>
<script lang="ts" setup>
import { zhCN, dateZhCN } from "naive-ui";
const lighten = (color: string, amount: number) => {
  color = color.indexOf("#") >= 0 ? color.substring(1, color.length) : color;
  amount = Math.trunc((255 * amount) / 100);
  return `#${addLight(color.substring(0, 2), amount)}${addLight(color.substring(2, 4), amount)}${addLight(
    color.substring(4, 6),
    amount
  )}`;
};
const addLight = (color: string, amount: number) => {
  const cc = parseInt(color, 16) + amount;
  const c = cc > 255 ? 255 : cc;
  return c.toString(16).length > 1 ? c.toString(16) : `0${c.toString(16)}`;
};
const lightenStr = lighten("#2d8cf0", 6);
const themeOverrides = {
  common: {
    primaryColor: "#2d8cf0",
    primaryColorSuppl: "#2d8cf0",
    primaryColorHover: lightenStr,
    primaryColorPressed: lightenStr,
  },
};
</script>
<style scoped></style>
